package com.jcl.recruit.config.mapper;

import com.jcl.recruit.config.model.Config;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * @author 刘明新
 * @date 2018/8/2 下午1:16
 */
public interface ConfigMapper {

    @Select({
            "select * from config order by id desc"
    })
    List<Config> selectAllInfos();

    @Select({
            "select * from config where id = #{id}"
    })
    Config selectPrimaryKey(@Param("id") Integer id);

    @Update({
            "<script>",
            "update config set",
            "<if test=\"title != null\">title = #{title},</if>",
            "<if test=\"configkey != null\">configkey = #{configkey},</if>",
            "<if test=\"datas != null\">datas = #{datas}</if>",
            "where id = #{id}",
            "</script>"
    })
    int update(Config config);
}
